/* 
 * File:   Bitvector.cpp
 * Author: bluecat
 * 
 * Created on 2011年4月19日, 下午6:48
 */

#include "Bitvector.h"

Bitvector::Bitvector() {
    this->_size = UNIT_LENGTH;
    this->length = 1;
    this->data = new unsigned int[1];
}

Bitvector::Bitvector(int size) {
    this->_size = size;
    this->length = size/UNIT_LENGTH + 1;
    this->data = new unsigned int[length];
}

Bitvector::Bitvector(const Bitvector& orig) {
}

Bitvector::~Bitvector() {
}

inline void Bitvector::flip(){
    for(int i=0; i<length; i++)
        data[i] = ~data[i];
}

inline void Bitvector::flip(int pos) {
    Index ind = this->pos2ind(pos);
    unsigned int pattern = 1<< ind.;
}

Index Bitvector::pos2ind(int pos){
    return new Index(pos/UNIT_LENGTH, pos%UNIT_LENGTH);
}